<template>
  <div class="email-info">
    <Tooltip content="邮件" placement="bottom">
      <Badge type="warning" :count="countComputed" show-zero>
        <Button type="text" @click="openMailPage">
          <Icon :size="20" type="md-mail"/>
        </Button>
      </Badge>
    </Tooltip>
  </div>
</template>

<script>
export default {
  name: 'EmailInfo',
  props: {
    count: {
      type: Number,
      default: 0
    },
    hasRead: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    countComputed () {
      return this.hasRead ? 0 : this.count
    }
  },
  methods: {
    openMailPage () {
      // this.$router.push({
      //   path: ''
      // })
      this.$router.push({
        path: '/message/message-page'
      })
    }
  }
}
</script>

<style lang="stylus" scoped>
.email-info
  margin-right 12px
  & >>> .ivu-badge-count
    top 10px
  & >>> .ivu-btn.ivu-btn-text
    padding 5px 1px 6px
</style>
